﻿
namespace LS.Nc6.Application.Cms
{
    /// <summary>
    /// 栏目表
    /// </summary>
    public interface ICmsChannelService : IBaseInterface<CmsChannelEntity> {

        /// <summary>
        /// 获取一个对象
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        Task<CmsChannelEntity> GetModelAsync(Expression<Func<CmsChannelEntity, bool>> expression);

        /// <summary>
        /// 修改栏目排序
        /// </summary>
        /// <param name="channelId"></param>
        /// <param name="num"></param>
        /// <returns></returns>
        Task<int> SetTaxis(long channelId, int num);

        /// <summary>
        /// 修改栏目排序
        /// </summary>
        /// <param name="parentId"></param>
        /// <param name="channelId"></param>
        /// <param name="isUp"></param>
        /// <returns></returns>
        Task<int> UpdateTaxis(long parentId, long channelId,int isUp);

        /// <summary>
        /// 修改栏目分组
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="groupNames"></param>
        /// <returns></returns>
        Task<int> UpdateGroupName(string ids, string groupNames);

        /// <summary>
        /// 获取栏目索引
        /// </summary>
        /// <returns></returns>
        Task<List<string>> GetIndexNames();

        /// <summary>
        /// 获取最大排序号
        /// </summary>
        /// <param name="parentId"></param>
        /// <returns></returns>
        Task<int> GetMaxTaxis(long parentId);

        /// <summary>
        /// 更新栏目子级项目
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<int> UpdateChildrenCount(long id);

        /// <summary>
        /// 获取子级项目数量
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<int> GetChildrenCount(long id);

        /// <summary>
        /// 是父级或自身返回true
        /// </summary>
        /// <param name="parentId"></param>
        /// <param name="childId"></param>
        /// <returns></returns>
        Task<bool> IsAncestorOrSelfAsync(long parentId, long childId);
        

        /// <summary>
        /// 获取栏目id
        /// </summary>
        /// <param name="channelId">栏目id</param>
        /// <param name="scopeType">0= 本身 1=本身和子级 2=子级 3=后代(Recursive)</param>
        /// <returns></returns>
        Task<List<long>> GetChannelIdsAsync(long channelId, int scopeType);
    }
}
